#define DEBUG
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

const int maxn=100000;

class Seg {
public:
  int l, r, id;


  static bool cmp(Seg a, Seg b) {
    return a.l<b.l || (a.l==b.l && a.r<b.r);
  }
};

void solve1(int o, int n, Seg s[]) {
  static int book[maxn+1];
  if (o<=n) {
    book[o] = 1;
    solve1(o+1, n, s);
    book[o] = 0;
    solve1(o+1, n, s);
  } else {
    static int ans[maxn+1];
    for (int i=1; i<=n; i++) {
      static int suml[2], sumr[2];
      suml[0]=suml[1]=sumr[0]=sumr[1] = 0;
      for (int j=1; j<=n; j++) {
	if (s[j].l<=s[i].l && s[j].r>=s[i].l) {
	  suml[book[j]]++;
	}
	if (s[j].l<=s[i].r && s[j].r>=s[i].r) {
	  sumr[book[j]]++;
	}
      }
      if (abs(suml[0]-suml[1])>1 || abs(sumr[0]-sumr[1])>1) {
	return;
      }
      ans[s[i].id] = book[i];
    }
    for (int i=1; i<=n; i++) {
      printf("%d ", ans[i]);
    }
    exit(0);
  }
}

void solve2(int n, Seg s[]) {
  static int ans[maxn+1];
  for (int i=1; i<=n; i+=2) {
    ans[s[i].id] = 0;
    if (i+1<=n) {
      ans[s[i+1].id] = 1;
    }
  }
  for (int i=1; i<=n; i++) {
    printf("%d ", ans[i]);
  }
}

int main() {
#ifdef DEBUG
  freopen("2.in", "r", stdin);
  freopen("2.out", "w", stdout);
#endif

  static Seg segs[maxn+1];
  int n;
  scanf("%d", &n);
  for (int i=1; i<=n; i++) {
    scanf("%d %d", &segs[i].l, &segs[i].r);
    segs[i].id = i;
  }

  sort(segs+1, segs+n+1, Seg::cmp);

  if (n<=20) {
    solve1(1, n, segs);
    printf("-1\n");
  } else {
    solve2(n, segs);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
